<?php
include_once('../../../include/init.php');
include(DIR_ROOT_P.'/include/checklogin.php');
include(DIR_ROOT_P.'/header.php');

?>
<?php
    $article_category_id = fs_get_value("article_category_id");
?>
<div class="content">
    <?php include(DIR_ROOT_P.'/html_middle_left.php');?>  
	<div class="content_right">
		<div class="article">
			<div class="top">
				<div class="left">标题</div>
				<div class="right">日期</div>
			</div>
			<?php
				$sql = "select * from ".TABLE_ARTICLE." where article_category_id = ".$article_category_id." order by article_datetime desc";
				$result = $db -> query($sql);
				$recordcount = $db -> num_rows($result);
				@$page=$_GET['p'];
				if ($page==null){$page=1;}
				$pagesize=13;								//每页显示数
				$pagecount=ceil($recordcount/$pagesize);	//计算总页
				if ($page>$pagecount){$page=$pagecount;}
				if ($page<1){$page=1;}
				$result=$db->query($sql." limit ".($page-1)*($pagesize).",$pagesize");
				$i = ($page-1)*($pagesize);
				while($row=$db->fetch_array($result)){
					$i = $i + 1;
			?>
			<div class="list">
				<div class="left">· <a href="<?php echo(DIR_ROOT_A."/main/article/show/?article_id=".$row['article_id']);?>"><?php echo($row['article_title']);?></a></div>
				<div class="right"><?php echo(date("Y-m-d",$row['article_datetime']));?></div>
			</div>
			<?php
				}
			?>
			<div class="bottom"><?php echo(pager(DIR_ROOT_A.'/main/article/list/?p={page}&article_category_id='.$article_category_id,$recordcount,($page-1)*($pagesize),$pagesize));?></div>
		</div>
	</div>
</div>
<?php
include(DIR_ROOT_P.'/bottom.php');
?>